package cn.oniokey.waterDetection.controller;

import cn.oniokey.waterDetection.domain.Water;
import cn.oniokey.waterDetection.service.WaterService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("api/water")
public class GetNewWaterByIdController {
    final
    WaterService waterService;

    public GetNewWaterByIdController(WaterService waterService) {
        this.waterService = waterService;
    }

    @PostMapping("/getNewWaterById")
    public Water getWaterById(@RequestBody Water water) {
        return waterService.getNewWaterById(water.getClientId());
    }
}
